<template>
    <el-dialog title="添加部门" :visible.sync="value" :before-close="close" width="700px">
        <el-form :model="formData" :rules="formRules" ref="formRef">
            <el-form-item prop="sex" label="上级部门">
                <el-select placeholder="请选择上级部门">
                    <el-option></el-option>
                </el-select>
            </el-form-item>
            <el-form-item prop="name" label="部门名称">
                <el-input placeholder="请填写部门名称" v-model="formData.name"></el-input>
            </el-form-item>
        </el-form>
        <div slot="footer">
            <el-button type="primary" @click="submit">添加</el-button>
            <el-button @click="close">关闭</el-button>
        </div>
    </el-dialog>
</template>
<script>
export default {
    data() {
        return {
            formData:{
                
            },
            formRules:{
                
            },
            
        }
    },
    props: {
        value: Boolean
    },
    methods: {
        submit(){
            this.$refs.formRef.validate((valid)=>{
                if(valid){
                    console.log('yes')
                }
            })
        },
        close(){
            Object.assign(this.$data,this.$options.data())
            this.$emit('input',false)
        }
    }
}
</script>